<template>
  <main>
    <div class="require-container">
      <div class="require-title">
        <span style="font-weight: 600; margin-left: 20px; margin-right: 20px">
          需求详情页面
        </span>
      </div>
      <div class="require-body">
        <h4>当前需求阶段</h4>
        <div class="form-content-circle">
          <div
            style="display: flex; align-items: center"
            v-for="(item, index) in config"
            :key="item.title"
          >
            <div
              :class="[
                'outer-circle',
                { 'outer-circle-none': item.status !== form.status },
              ]"
            >
              <div class="inner-circle"></div>
              <div class="title">
                {{ item.title }}
              </div>
              <span></span>
              <span></span>
              <span></span>
              <span></span>
            </div>
            <div v-if="index + 1 !== config.length" class="split-line">-></div>
          </div>
          <div class="clear"></div>
        </div>
      </div>
      <div class="require-body">
        <h4>采购需求</h4>
        <div class="form-content">
          <el-form
            :rules="rules"
            ref="ruleForm"
            label-position="right"
            label-width="90px"
            :model="form"
          >
            <el-form-item label="需求类型" prop="reqType">
              <el-input :disabled="true" v-model="form.reqType"></el-input>
            </el-form-item>
            <el-form-item label="项目名称" prop="proName">
              <el-input :disabled="true" v-model="form.proName"></el-input>
            </el-form-item>
            <el-form-item label="工程类型" prop="proType">
              <el-input :disabled="true" v-model="form.proType"></el-input>
            </el-form-item>
            <el-form-item label="工程编码">
              <el-input :disabled="true" v-model="form.proCode"></el-input>
            </el-form-item>
            <el-form-item label="采购类别">
              <el-input :disabled="true" v-model="form.bugType"></el-input>
            </el-form-item>
            <el-form-item label="估算价格">
              <el-input :disabled="true" v-model="form.prePrice"></el-input>
            </el-form-item>
            <el-form-item label="采购范围">
              <el-input :disabled="true" v-model="form.buyRange"></el-input>
            </el-form-item>
            <el-form-item label="工期需求">
              <el-input :disabled="true" v-model="form.timeReq"></el-input>
            </el-form-item>
            <el-form-item label="供应商需求">
              <el-input :disabled="true" v-model="form.busReq"></el-input>
            </el-form-item>
            <el-form-item label="需求原因">
              <el-input :disabled="true" v-model="form.reqCause"></el-input>
            </el-form-item>
          </el-form>
          <div class="clear"></div>
        </div>
      </div>
    </div>
  </main>
</template>

<script>
import { reviewRequirement, getReqById } from "api/require.api";
import config from "./config";

export default {
  name: "RequireDetail",
  data() {
    return {
      config: config,
      form: {
        id: "",
        reqType: "",
        proName: "",
        proType: "",
        status: "",
        proCode: "",
        bugType: "",
        prePrice: "",
        buyRange: "",
        timeReq: "",
        busReq: "",
        reqCause: "",
        bidCompany: "",
      },
      scoreForm: {
        expScore: 0,
        bidPriceScore: 0,
        executeScore: 0,
      },
      rules: {
        reqType: [{ required: true, message: "请输入内容", trigger: "blur" }],
        proType: [{ required: true, message: "请输入内容", trigger: "blur" }],
        proName: [{ required: true, message: "请输入内容", trigger: "blur" }],
      },
    };
  },
  created() {
    this.form = getReqById(this.$route.query.id).data;
  },
  methods: {
    getId() {
      return new Date().getTime();
    },
    toScore() {
      reviewRequirement({ ...this.form, ...this.scoreForm });
      this.$message.success("评审成功");
      setTimeout(() => {
        this.$router.push({
          path: "waitReview",
        });
      }, 0);
    },
    resetForm(formName) {
      this.$refs[formName].resetFields();
    },
  },
};
</script>

<style lang="less" scoped>
.require-container { margin: 0 auto;
  max-width: 80vw;
  padding: 20px;
  ::v-deep {
    .el-form-item {
      width: 40%;
      float: left;
      &__content {
        width: 50%;
      }
    }
  }
  .require-title {
    padding: 20px;
    display: flex;
    align-items: center;
    width: 100%;
    margin-bottom: 20px;
    background-color: #fff;
  }
  .clear {
    clear: both;
  }
  .require-body {
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 30px;
    overflow: auto;
    background-color: #fff;
  }
  .form-content {
    margin-left: 80px;
    margin-top: 50px;
    margin-bottom: 55px;
  }
  .form-content-circle {
    margin-left: 80px;
    margin-top: 50px;
    margin-bottom: 55px;
    display: flex;
    align-items: center;
    .split-line {
      font-size: 50px;
    }
  }
}
h4 {
  margin-left: 20px;
}
.outer-circle {
  position: relative;
  height: 200px;
  width: 200px;
  background: linear-gradient(#14ffe9, #ffeb3b, #ff00e0);
  border-radius: 50%;
  animation: rotate 1.5s linear infinite;
  .title {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 24px;
    z-index: 100;
  }
  span:nth-child(1) {
    filter: blur(5px);
  }

  span:nth-child(2) {
    filter: blur(10px);
  }

  span:nth-child(3) {
    filter: blur(25px);
  }

  span:nth-child(4) {
    filter: blur(150px);
  }
}

.outer-circle span {
  position: absolute;
  height: 200px;
  width: 200px;
  background: linear-gradient(#14ffe9, #ffeb3b, #ff00e0);
  border-radius: 50%;
}
.outer-circle-none {
  background: none;
  span {
    background: none;
  }
}

.inner-circle {
  height: 180px;
  width: 180px;
  position: absolute;
  background: black;
  top: 10px;
  left: 10px;
  border-radius: 50%;
  z-index: 9;
}

@keyframes rotate {
  0% {
    filter: hue-rotate(0deg);
  }
  100% {
    filter: hue-rotate(360deg);
  }
}
</style>